home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
CUGUK
/
C005.ZIP
/
FLOOR.C
< prev
next >
Wrap
Text File
|
1990-01-19
|
1KB
|
42 lines
/********************************************************************
* C Users Group (U.K) C Source Code Library File CUGLIB.005 *
* Inquiries to: M. Houston, 36 Whetstone Clo. Farquhar Rd. *
* Edgbaston, Birmingham B15 2QN ENGLAND *
********************************************************************
* File name: floor.c
* Program name: library modules only
* Source of file: The Public Domain Software Library.
* Purpose: maths function
* Changes: <who what when & why major changes have been made>
********************************************************************/
/***********************************************************
* The TULSA IBM C BOARD *
* 918-664-8737 *
* 300/1200 XMODEM, 24 Hours *
**********************************************************/
#include "math.h"
double floor(d)
double d;
{
if (d < 0.0)
return -ceil(-d);
modf(d, &d);
return d;
}
double ceil(d)
double d;
{
if (d < 0.0)
return -floor(-d);
if (modf(d, &d) > 0.0)
++d;
return d;
}